<? include("conn.php") ?>
<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <?php include("public/cssjs.php");?>
    <link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
    <link href="static/city/css/city-picker.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-member-add" name="form1">

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺名称：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="店铺名称" id="s_name" name="s_name">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>所属区域：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select class="select" name="s_areaid" id="s_areaid" size="1">
                    <option value="0">选择区域</option>
                    <?php ShowSelect(0,"newscata_area",$areaid,6,true) ?>

                </select>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺店长：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <select class="select" name="s_manage_id" id="s_manage_id" size="1">
                    <option value="0">选择店长</option>
                   <?php
                   $conn=new Mysql();
                   $row=$conn->getAll("select * from d_worker");
                   foreach ($row as $k=>$rs){
                       ?>
                       <option value="<?php echo $rs["id"]?>"><?php echo $rs["w_name"]?></option>
                       <?php
                   }
                   ?>

                </select>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺logo：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <iframe
                        src="../pic/images_UP.php?bd=a1_img&form=form1" name="key" width="448"
                        height="30" marginheight="0" scrolling="No" frameborder="0" id="key">IE</iframe>
                <input type="text" name="a1_img" id="a1_img" class="input-text"  size="60">
            </div>
        </div>
        <div class="row cl ">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" name="s_tel" id="s_tel" placeholder="联系电话" maxlength="11"  class="input-text" style="width:40%">
                </div>
        </div>
        <div class="row cl ">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>详细地址：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" name="s_address" id="s_address" placeholder="详细地址"  class="input-text" style="width:70%">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>店铺启用：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <div class="radio-box">
                    <input name="istate" type="radio" value="1" id="istate-1" checked>
                    <label for="xiaji-1">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="istate-2" value="0" name="istate">
                    <label for="xiaji-2">否</label>
                </div>

            </div>

        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交</button>

                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/h-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/h-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    $(function(){

        $("#form-member-add").validate({
            rules:{
                title:{
                    required:true
                }

            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){

                var s_name=$("#s_name").val();
                var s_areaid=$("#s_areaid").val();
                var s_manage_id=$("#s_manage_id").val();
                var s_tel=$("#s_tel").val();
                var s_address=$("#s_address").val();
                var istate=$('input[name="istate"]').val();
                var s_logo=$("#a1_img").val();
                $.ajax({
                    type:"POST",
                    url:"json/shop.php" ,
                    data:{'s_name':s_name,'s_areaid':s_areaid,'s_manage_id':s_manage_id,'s_tel':s_tel,'s_address':s_address,'s_logo':s_logo,'istate':istate,'Type':'up'},
                    datatype: "json",
                    success:function(data){
                        if(data==1){
                            layer.msg('添加成功!',{icon:1,time:1000});
                            var index=parent.layer.getFrameIndex(window.name);
                            window.parent.location.reload();
                            parent.layer.close(index);
                        }else{
                            console.log(data);
                            alert(data);
                            //layer.msg('系统错误error!'+data,{icon:1,time:1000});
                        }


                    }
                });


            }
        });
        //alert("enter:"+UE.getEditor('editor').getContent());
    });

</script>
<script src="static/city/js/city-picker.data.js"></script>
<script src="static/city/js/city-picker.js"></script>
</body>
</html>